#!/bin/bash
service_name=ruoyi-admin

pid=`ps -ef|grep ${service_name}|grep -v 'grep'|awk '{print $2}'`

if [ ! -z $pid ];then
  kill -9 $pid
  echo "============= 关闭 ${service_name} pid: ${pid} ============="
fi

sleep 3

nohup java -jar ${service_name}.jar > ruoyi.log 2>&1 &

sleep 3

pid=`ps -ef|grep ${service_name}|grep -v 'grep'|awk '{print $2}'`

echo "============= 启动 ${service_name} pid: ${pid} ============="

sleep 1

# 有无新dist包
if [ -e dist.zip ];then
 unzip -o dist.zip > /dev/null
 echo "============= 更新 page ============="
fi
